
const app = getApp()
const $api = require('../../../utils/api.js').API;

Page({
    data: {
        count:0,
        select_true1:true,
        select_true2:false,
        list:[],
        dataType:1,//商品
        uid:wx.getStorageSync('uid'),
        list1:[],
        list2:[]
    },
    onLoad:function(){
        wx.showLoading()
        this.getCount();
        this.getlist();
    },
    getCount:function(){
        var that = this
        var data = {'uid':wx.getStorageSync('uid')}
        $api.get('agent/count',data).then(res => {
            if(res.data.code == 1){
                that.setData({
                    count:res.data.data
                })
            }
        })
    },
    getlist: function(){
        var that = this
        var data ={'uid':wx.getStorageSync('uid')}
        $api.get('agent/moneyList',data).then(res => {
            wx.hideLoading();
            if(res.data.code == 1){
                that.setData({
                    list:res.data.data.vip,
                    list1:res.data.data.vip,
                    list2:res.data.data.no
                })
            }
        })
    },
    selectCate:function(e){
        var ii = e.currentTarget.dataset.index;
        var type = 'select_true'+ii
        this.setData({
            dataType:ii,
            pageShow:true,
            select_true1:false,
            select_true2:false,
        });
        this.setData({
            [type]:true
        })
        if(ii == 1){
            this.setData({
                list:this.data.list1
            })
        }else{
            this.setData({
                list:this.data.list2
            })
        }
    },
    onShareAppMessage: function() {
        return {
            title: "天意美业直通车",
            path: "/pages/index/index?puid="+wx.getStorageSync('uid')
        };
      }
});